package com.sbm.shiro;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.session.Session;

public class ShiroSessionCache implements Cache<Serializable, Session> {

	private final static Map<Serializable, Session> cache = new HashMap<Serializable, Session>();

	@Override
	public void clear() throws CacheException {
		cache.clear();
	}

	@Override
	public Session get(Serializable key) throws CacheException {
		return cache.get(key);
	}

	@Override
	public Set<Serializable> keys() {
		return cache.keySet();
	}

	@Override
	public Session put(Serializable key, Session session) throws CacheException {
		return cache.put(key, session);
	}

	@Override
	public Session remove(Serializable key) throws CacheException {
		return cache.remove(key);
	}

	@Override
	public int size() {
		return cache.size();
	}

	@Override
	public Collection<Session> values() {
		return cache.values();
	}

}
